<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子31-ES6/7常用语法介绍</title>
    </head>

    <body>
        <pre>
            <code>
                // 例子31

                const target = {a: 1, b: 1};
                const source1 = {b: 2, c: 2};
                const source2 = {c: 3, d: 4};

                Object.assign(target, source1, source2);
                console.log(target); // {a: 1, b: 2, c: 3, d: 4}

                //--------------------------------------------------------------------------

                const target = {}
                const source = {
                    a: 1,
                    b: 'b',
                    c() {
                        console.log('c');
                    }
                }
                Object.defineProperty(source, 'a', {
                    enumerable: false
                })
                Object.assign(target, source);
                console.log(target); //  {b: "b", c: ƒ}
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/31.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>